package com.example.shopping.shdatas;

import com.example.shopping.api.SHResponseData;

import java.util.Date;

/**
 * Created by doanht on 12/5/13.
 */
public class SHProduce extends SHResponseData{
    public SHProduce oldProduce;

    public String itemCd;
    public String itemNameKj;
    public String itemNameKn;
    public String dispSpecName;
    public String makerName;
    public String sellerItemCd;
    public int taxKbn;
    public int itemKbn;
    public int orderQty;
    public double cost;
    public double price;
    public Date regDatetime;
    public Date updDatetime;
    public SHSeller seller;


    public SHProduce(){

    }

    public void updateOldProduce(){
        if (oldProduce == null){
            oldProduce = new SHProduce();
        }
        oldProduce.itemCd = itemCd;
        oldProduce.itemNameKj = itemNameKj;
        oldProduce.itemNameKn = itemNameKn;
        oldProduce.dispSpecName = dispSpecName;
        oldProduce.makerName = makerName;
        oldProduce.sellerItemCd = sellerItemCd;

        oldProduce.taxKbn = taxKbn;
        oldProduce.itemKbn = itemKbn;
        oldProduce.orderQty = orderQty;

        oldProduce.cost = cost;
        oldProduce.price = price;
        oldProduce.regDatetime = regDatetime;
        oldProduce.updDatetime = updDatetime;
    }

    @Override
    public boolean hasChange() {
        return oldProduce == null || oldProduce.orderQty != orderQty;
    }
}
